<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>ArNetworking: drawingsExampleWithRobot.cpp</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">ArNetworking
   &#160;<span id="projectnumber">dev20161014</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('drawingsExampleWithRobot_8cpp-example.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">drawingsExampleWithRobot.cpp</div>  </div>
</div><!--header-->
<div class="contents">
<p>Example showing how to draw custom graphics in clients such as MobileEyes, and enable drawing of sensor readings as well.This is an example server that shows how to draw arbitrary figures in a client (e.g. MobileEyes). It also uses the convenient built-in support for visualization built in to <a class="elRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArRobot.html">ArRobot</a>, <a class="elRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArSick.html">ArSick</a>, <a class="elRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArSonarDevice.html">ArSonarDevice</a>, etc.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="drawingsExample_8cpp.html">drawingsExample.cpp</a> which does not include robot and sensor drawings</dd></dl>
<div class="fragment"><div class="line"><span class="preprocessor">#include &quot;Aria.h&quot;</span></div><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="ArNetworking_8h.html">ArNetworking.h</a>&quot;</span></div><div class="line"><span class="preprocessor">#include &lt;math.h&gt;</span></div><div class="line"></div><div class="line"><span class="comment">/* These are callbacks that respond to client requests for the drawings&#39; </span></div><div class="line"><span class="comment"> * geometry data. */</span></div><div class="line"><span class="keywordtype">void</span> <a name="a0"></a><a class="code" href="drawingsExampleWithRobot_8cpp.html#a7c8ed01400d514a7b9105b92c325f26a">exampleHomeDrawingNetCallback</a>(<a name="_a1"></a><a class="code" href="classArServerClient.html">ArServerClient</a>* <a name="a2"></a><a class="code" href="changeMapOnServer_8cpp.html#afe594bfb305907ae82f259409cc214cb">client</a>, <a name="_a3"></a><a class="code" href="classArNetPacket.html">ArNetPacket</a>* requestPkt);</div><div class="line"><span class="keywordtype">void</span> <a name="a4"></a><a class="code" href="drawingsExampleWithRobot_8cpp.html#a829cc347fa8f03be4f7e21f52a56b23d">exampleDotsDrawingNetCallback</a>(<a class="code" href="classArServerClient.html">ArServerClient</a>* <a class="code" href="changeMapOnServer_8cpp.html#afe594bfb305907ae82f259409cc214cb">client</a>, <a class="code" href="classArNetPacket.html">ArNetPacket</a>* requestPkt);</div><div class="line"><span class="keywordtype">void</span> <a name="a5"></a><a class="code" href="drawingsExampleWithRobot_8cpp.html#ae35734c611c1c0f5e9bc6287f5eee070">exampleXDrawingNetCallback</a>(<a class="code" href="classArServerClient.html">ArServerClient</a>* <a class="code" href="changeMapOnServer_8cpp.html#afe594bfb305907ae82f259409cc214cb">client</a>, <a class="code" href="classArNetPacket.html">ArNetPacket</a>* requestPkt);</div><div class="line"><span class="keywordtype">void</span> <a name="a6"></a><a class="code" href="drawingsExampleWithRobot_8cpp.html#abab39eb1a7fa3903841c77dabeb465f9">exampleArrowsDrawingNetCallback</a>(<a class="code" href="classArServerClient.html">ArServerClient</a>* <a class="code" href="changeMapOnServer_8cpp.html#afe594bfb305907ae82f259409cc214cb">client</a>, <a class="code" href="classArNetPacket.html">ArNetPacket</a>* requestPkt);</div><div class="line"></div><div class="line"><span class="keywordtype">int</span> <a name="a7"></a><a class="code" href="drawingsExampleWithRobot_8cpp.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a>(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv)</div><div class="line">{</div><div class="line">  <a name="a8"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classAria.html#ad99c16b5d947229d9f8e1c5b2d4cdd73">Aria::init</a>();</div><div class="line">  <a name="_a9"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArRobot.html">ArRobot</a> robot;</div><div class="line">  <a name="_a10"></a><a class="code" href="classArServerBase.html">ArServerBase</a> server;</div><div class="line"></div><div class="line">  <a name="_a11"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArArgumentParser.html">ArArgumentParser</a> parser(&amp;argc, argv);</div><div class="line">  <a name="_a12"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArSimpleConnector.html">ArSimpleConnector</a> simpleConnector(&amp;parser);</div><div class="line">  <a name="_a13"></a><a class="code" href="classArServerSimpleOpener.html">ArServerSimpleOpener</a> simpleOpener(&amp;parser);</div><div class="line"></div><div class="line"></div><div class="line">  <span class="comment">// parse the command line... fail and print the help if the parsing fails</span></div><div class="line">  <span class="comment">// or if help was requested</span></div><div class="line">  parser.loadDefaultArguments();</div><div class="line">  <span class="keywordflow">if</span> (!simpleConnector.parseArgs() || !simpleOpener.parseArgs() || </div><div class="line">      !parser.checkHelpAndWarnUnparsed())</div><div class="line">  {    </div><div class="line">    simpleConnector.logOptions();</div><div class="line">    simpleOpener.logOptions();</div><div class="line">    exit(1);</div><div class="line">  }</div><div class="line"></div><div class="line">  <span class="comment">// Set up where we&#39;ll look for files such as config file, user/password file,</span></div><div class="line">  <span class="comment">// etc.</span></div><div class="line">  <span class="keywordtype">char</span> fileDir[1024];</div><div class="line">  <a name="a14"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArUtil.html#a196eae227f3e6fc7387bb623b4ddea03">ArUtil::addDirectories</a>(fileDir, <span class="keyword">sizeof</span>(fileDir), <a name="a15"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classAria.html#a9cbf9a172cb85275b05d391685f223e0">Aria::getDirectory</a>(), </div><div class="line">                         <span class="stringliteral">&quot;ArNetworking/examples&quot;</span>);</div><div class="line"></div><div class="line">  <span class="comment">// first open the server up</span></div><div class="line">  <span class="keywordflow">if</span> (!simpleOpener.open(&amp;server, fileDir, 240))</div><div class="line">  {</div><div class="line">    <span class="keywordflow">if</span> (simpleOpener.wasUserFileBad())</div><div class="line">      printf(<span class="stringliteral">&quot;Error: Bad user/password/permissions file.\n&quot;</span>);</div><div class="line">    <span class="keywordflow">else</span></div><div class="line">      printf(<span class="stringliteral">&quot;Error: Could not open server port. Use -help to see options.\n&quot;</span>);</div><div class="line">    exit(1);</div><div class="line">  }</div><div class="line"></div><div class="line"></div><div class="line">  <span class="comment">// Devices</span></div><div class="line">  <a name="_a16"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArAnalogGyro.html">ArAnalogGyro</a> gyro(&amp;robot);</div><div class="line"></div><div class="line">  <a name="_a17"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArSonarDevice.html">ArSonarDevice</a> sonarDev;</div><div class="line">  robot.<a name="a18"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArRobot.html#a97d57b28549fdef851c00749a97cc776">addRangeDevice</a>(&amp;sonarDev);</div><div class="line"></div><div class="line">  <a name="_a19"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArIRs.html">ArIRs</a> irs;</div><div class="line">  robot.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArRobot.html#a97d57b28549fdef851c00749a97cc776">addRangeDevice</a>(&amp;irs);</div><div class="line"></div><div class="line">  <a name="_a20"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBumpers.html">ArBumpers</a> bumpers;</div><div class="line">  robot.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArRobot.html#a97d57b28549fdef851c00749a97cc776">addRangeDevice</a>(&amp;bumpers);</div><div class="line"></div><div class="line">  <a name="_a21"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArSick.html">ArSick</a> sick(361, 180);</div><div class="line">  robot.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArRobot.html#a97d57b28549fdef851c00749a97cc776">addRangeDevice</a>(&amp;sick);  </div><div class="line">  </div><div class="line"></div><div class="line">  <a name="_a22"></a><a class="code" href="classArServerInfoRobot.html">ArServerInfoRobot</a> serverInfoRobot(&amp;server, &amp;robot);</div><div class="line">  <a name="_a23"></a><a class="code" href="classArServerInfoSensor.html">ArServerInfoSensor</a> serverInfoSensor(&amp;server, &amp;robot);</div><div class="line"></div><div class="line">  <span class="comment">// This is the service that provides drawing data to the client.</span></div><div class="line">  <a name="_a24"></a><a class="code" href="classArServerInfoDrawings.html">ArServerInfoDrawings</a> drawings(&amp;server);</div><div class="line"></div><div class="line">  <span class="comment">// Convenience function that sets up drawings for all the robot&#39;s current</span></div><div class="line">  <span class="comment">// range devices (using default shape and color info)</span></div><div class="line">  drawings.addRobotsRangeDevices(&amp;robot);</div><div class="line"></div><div class="line">  <span class="comment">// Add our custom drawings</span></div><div class="line">  drawings.addDrawing(</div><div class="line">      <span class="comment">//                shape:      color:               size:   layer:</span></div><div class="line">      <span class="keyword">new</span> <a name="_a25"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArDrawingData.html">ArDrawingData</a>(<span class="stringliteral">&quot;polyLine&quot;</span>, <a name="_a26"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArColor.html">ArColor</a>(255, 0, 0),  2,      49),</div><div class="line">      <span class="stringliteral">&quot;exampleDrawing_Home&quot;</span>, </div><div class="line">      <span class="keyword">new</span> <a name="_a27"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArGlobalFunctor2.html">ArGlobalFunctor2&lt;ArServerClient*, ArNetPacket*&gt;</a>(&amp;<a class="code" href="drawingsExampleWithRobot_8cpp.html#a7c8ed01400d514a7b9105b92c325f26a">exampleHomeDrawingNetCallback</a>)</div><div class="line">  );</div><div class="line">  drawings.addDrawing(                                    </div><div class="line">      <span class="keyword">new</span> <a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArDrawingData.html">ArDrawingData</a>(<span class="stringliteral">&quot;polyDots&quot;</span>, <a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArColor.html">ArColor</a>(0, 255, 0), 250, 48),</div><div class="line">      <span class="stringliteral">&quot;exampleDrawing_Dots&quot;</span>, </div><div class="line">      <span class="keyword">new</span> <a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArGlobalFunctor2.html">ArGlobalFunctor2&lt;ArServerClient*, ArNetPacket*&gt;</a>(&amp;<a class="code" href="drawingsExampleWithRobot_8cpp.html#a829cc347fa8f03be4f7e21f52a56b23d">exampleDotsDrawingNetCallback</a>)</div><div class="line">  );</div><div class="line">  drawings.addDrawing(</div><div class="line">      <span class="keyword">new</span> <a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArDrawingData.html">ArDrawingData</a>(<span class="stringliteral">&quot;polySegments&quot;</span>, <a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArColor.html">ArColor</a>(0, 0, 0), 4, 52),</div><div class="line">      <span class="stringliteral">&quot;exampleDrawing_XMarksTheSpot&quot;</span>, </div><div class="line">      <span class="keyword">new</span> <a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArGlobalFunctor2.html">ArGlobalFunctor2&lt;ArServerClient*, ArNetPacket*&gt;</a>(&amp;<a class="code" href="drawingsExampleWithRobot_8cpp.html#ae35734c611c1c0f5e9bc6287f5eee070">exampleXDrawingNetCallback</a>)</div><div class="line">  );</div><div class="line">  drawings.addDrawing(</div><div class="line">      <span class="keyword">new</span> <a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArDrawingData.html">ArDrawingData</a>(<span class="stringliteral">&quot;polyArrows&quot;</span>, <a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArColor.html">ArColor</a>(255, 0, 255), 500, 100),</div><div class="line">      <span class="stringliteral">&quot;exampleDrawing_Arrows&quot;</span>, </div><div class="line">      <span class="keyword">new</span> <a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArGlobalFunctor2.html">ArGlobalFunctor2&lt;ArServerClient*, ArNetPacket*&gt;</a>(&amp;<a class="code" href="drawingsExampleWithRobot_8cpp.html#abab39eb1a7fa3903841c77dabeb465f9">exampleArrowsDrawingNetCallback</a>)</div><div class="line">  );</div><div class="line"></div><div class="line">  <span class="comment">// modes for moving the robot</span></div><div class="line">  <a name="_a28"></a><a class="code" href="classArServerModeStop.html">ArServerModeStop</a> modeStop(&amp;server, &amp;robot);</div><div class="line">  <a name="_a29"></a><a class="code" href="classArServerModeDrive.html">ArServerModeDrive</a> modeDrive(&amp;server, &amp;robot);</div><div class="line">  <a name="_a30"></a><a class="code" href="classArServerModeRatioDrive.html">ArServerModeRatioDrive</a> modeRatioDrive(&amp;server, &amp;robot);</div><div class="line">  <a name="_a31"></a><a class="code" href="classArServerModeWander.html">ArServerModeWander</a> modeWander(&amp;server, &amp;robot);</div><div class="line">  modeStop.addAsDefaultMode();</div><div class="line">  modeStop.activate();</div><div class="line"></div><div class="line">  </div><div class="line"></div><div class="line">  <span class="comment">// Connect to the robot.</span></div><div class="line">  <span class="keywordflow">if</span> (!simpleConnector.connectRobot(&amp;robot))</div><div class="line">  {</div><div class="line">    printf(<span class="stringliteral">&quot;Error: Could not connect to robot... exiting\n&quot;</span>);</div><div class="line">    <a name="a32"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classAria.html#a184602a2b3799d61569ec55dd9508450">Aria::shutdown</a>();</div><div class="line">    <span class="keywordflow">return</span> 1;</div><div class="line">  }</div><div class="line"></div><div class="line">  <span class="comment">// set up the laser before handing it to the laser mode</span></div><div class="line">  simpleConnector.setupLaser(&amp;sick);</div><div class="line"></div><div class="line">  robot.<a name="a33"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/group__easy.html#gaa3657bebab0086dd14ed0c8c3f76dc8b">enableMotors</a>();</div><div class="line"></div><div class="line">  <span class="comment">// start the robot cycle running in a background thread</span></div><div class="line">  robot.<a name="a34"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArRobot.html#a3c3d878cfd11a2ef91230005a83bfcaa">runAsync</a>(<span class="keyword">true</span>);</div><div class="line"></div><div class="line">  <span class="comment">// start the laser processing cycle in a background thread</span></div><div class="line">  sick.runAsync();</div><div class="line"></div><div class="line">  <span class="comment">// connect the laser if it was requested</span></div><div class="line">  <span class="keywordflow">if</span> (!simpleConnector.connectLaser(&amp;sick))</div><div class="line">  {</div><div class="line">    printf(<span class="stringliteral">&quot;Error: Could not connect to laser... exiting\n&quot;</span>);</div><div class="line">    <a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classAria.html#a184602a2b3799d61569ec55dd9508450">Aria::shutdown</a>();</div><div class="line">    <span class="keywordflow">return</span> 1;</div><div class="line">  }</div><div class="line"></div><div class="line">  <span class="comment">// log whatever we wanted to before the runAsync</span></div><div class="line">  simpleOpener.checkAndLog();</div><div class="line"></div><div class="line">  <span class="comment">// run the server thread in the background</span></div><div class="line">  server.<a name="a35"></a><a class="code" href="classArServerBase.html#a93c742ddc58a8f035a0d1b9c1fae4599">runAsync</a>();</div><div class="line"></div><div class="line">  printf(<span class="stringliteral">&quot;Server is now running...\n&quot;</span>);</div><div class="line"></div><div class="line"></div><div class="line">  <span class="comment">// Add a key handler mostly that windows can exit by pressing</span></div><div class="line">  <span class="comment">// escape, note that the key handler prevents you from running this program</span></div><div class="line">  <span class="comment">// in the background on Linux.</span></div><div class="line">  <a name="_a36"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArKeyHandler.html">ArKeyHandler</a> *keyHandler;</div><div class="line">  <span class="keywordflow">if</span> ((keyHandler = <a name="a37"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classAria.html#a5b8042b38b19d6a5d3cfbed4df483e67">Aria::getKeyHandler</a>()) == NULL)</div><div class="line">  {</div><div class="line">    keyHandler = <span class="keyword">new</span> <a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArKeyHandler.html">ArKeyHandler</a>;</div><div class="line">    <a name="a38"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classAria.html#a9e5496a4ec2c379c8e18706922b57cc1">Aria::setKeyHandler</a>(keyHandler);</div><div class="line">    robot.<a name="a39"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArRobot.html#a5aecc7ac998c9a31b82fdb904efa8609">lock</a>();</div><div class="line">    robot.<a name="a40"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArRobot.html#ab4ea516667d2358f35b435d97b616ab1">attachKeyHandler</a>(keyHandler);</div><div class="line">    robot.<a name="a41"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArRobot.html#a403d9de010dc2b8d478cd0b14b2d9491">unlock</a>();</div><div class="line">    printf(<span class="stringliteral">&quot;To exit, press escape.\n&quot;</span>);</div><div class="line">  }</div><div class="line"></div><div class="line">  robot.<a name="a42"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/group__easy.html#ga95201be7c39b521983b51e6f5d9303e4">waitForRunExit</a>();</div><div class="line"> </div><div class="line"></div><div class="line">  <a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classAria.html#a184602a2b3799d61569ec55dd9508450">Aria::shutdown</a>();</div><div class="line">  exit(0);  </div><div class="line">}</div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"><span class="comment">// Network callbacks for drawings&#39; current geometry data:</span></div><div class="line"></div><div class="line"><span class="keywordtype">void</span> <a class="code" href="drawingsExampleWithRobot_8cpp.html#a7c8ed01400d514a7b9105b92c325f26a">exampleHomeDrawingNetCallback</a>(<a class="code" href="classArServerClient.html">ArServerClient</a>* <a class="code" href="changeMapOnServer_8cpp.html#afe594bfb305907ae82f259409cc214cb">client</a>, <a class="code" href="classArNetPacket.html">ArNetPacket</a>* requestPkt) {</div><div class="line">  <a class="code" href="classArNetPacket.html">ArNetPacket</a> reply;</div><div class="line"></div><div class="line">  <span class="comment">// 7 Vertices</span></div><div class="line">  reply.<a name="a43"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(7);</div><div class="line"></div><div class="line">  <span class="comment">// Centered on 0,0.</span></div><div class="line">  <span class="comment">// X:                    Y:</span></div><div class="line">  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(-500);  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(500);   <span class="comment">// Vertex 1</span></div><div class="line">  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(-500);  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(-500);  <span class="comment">// Vertex 2</span></div><div class="line">  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(500);   reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(-500);  <span class="comment">// Vertex 3</span></div><div class="line">  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(500);   reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(500);   <span class="comment">// Vertex 4</span></div><div class="line">  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(0);     reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(1000);  <span class="comment">// Vertex 5</span></div><div class="line">  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(-500);  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(500);   <span class="comment">// Vertex 6</span></div><div class="line">  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(500);   reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(500);   <span class="comment">// Vertex 7</span></div><div class="line"></div><div class="line">  client-&gt;<a name="a44"></a><a class="code" href="classArServerClient.html#a9276b1f38501725852c779058bad1d33">sendPacketUdp</a>(&amp;reply);</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keywordtype">void</span> <a class="code" href="drawingsExampleWithRobot_8cpp.html#a829cc347fa8f03be4f7e21f52a56b23d">exampleDotsDrawingNetCallback</a>(<a class="code" href="classArServerClient.html">ArServerClient</a>* client, <a class="code" href="classArNetPacket.html">ArNetPacket</a>* requestPkt) {</div><div class="line">  <a class="code" href="classArNetPacket.html">ArNetPacket</a> reply;</div><div class="line"></div><div class="line">  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> tik = <a name="a45"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArUtil.html#ad3496dfd2693d19553a399883a4e20e1">ArUtil::getTime</a>() % 200;</div><div class="line">  <span class="keywordtype">double</span> t = tik / 5.0;</div><div class="line"></div><div class="line">  <span class="comment">// Three dots</span></div><div class="line">  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(3);</div><div class="line"></div><div class="line">  <span class="comment">// Dot 1:</span></div><div class="line">  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(3000);  <span class="comment">// X coordinate (mm)</span></div><div class="line">  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>((<span class="keywordtype">int</span>) (<a name="a46"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/group__easy.html#gaeb05754b7747988dd97a961eaded6830">sin</a>(t) * 1000));<span class="comment">// Y</span></div><div class="line"></div><div class="line">  <span class="comment">// Dot 2:</span></div><div class="line">  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(3500);  <span class="comment">// X</span></div><div class="line">  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>((<span class="keywordtype">int</span>) (<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/group__easy.html#gaeb05754b7747988dd97a961eaded6830">sin</a>(t+500) * 1000));<span class="comment">// Y</span></div><div class="line"></div><div class="line">  <span class="comment">// Dot 3:</span></div><div class="line">  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(4000);  <span class="comment">// X</span></div><div class="line">  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>((<span class="keywordtype">int</span>) (<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/group__easy.html#gaeb05754b7747988dd97a961eaded6830">sin</a>(t+1000) * 1000));<span class="comment">// Y</span></div><div class="line"></div><div class="line">  client-&gt;<a class="code" href="classArServerClient.html#a9276b1f38501725852c779058bad1d33">sendPacketUdp</a>(&amp;reply);</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keywordtype">void</span> <a class="code" href="drawingsExampleWithRobot_8cpp.html#ae35734c611c1c0f5e9bc6287f5eee070">exampleXDrawingNetCallback</a>(<a class="code" href="classArServerClient.html">ArServerClient</a>* client, <a class="code" href="classArNetPacket.html">ArNetPacket</a>* requestPkt) {</div><div class="line">  <a class="code" href="classArNetPacket.html">ArNetPacket</a> reply;</div><div class="line"></div><div class="line">  <span class="comment">// X marks the spot. 2 line segments, so 4 vertices:</span></div><div class="line">  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(4);</div><div class="line"></div><div class="line">  <span class="comment">// Segment 1:</span></div><div class="line">  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(-4250); <span class="comment">// X1</span></div><div class="line">  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(250);   <span class="comment">// Y1</span></div><div class="line">  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(-3750); <span class="comment">// X2</span></div><div class="line">  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(-250);  <span class="comment">// Y2</span></div><div class="line"></div><div class="line">  <span class="comment">// Segment 2:</span></div><div class="line">  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(-4250); <span class="comment">// X1</span></div><div class="line">  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(-250);  <span class="comment">// Y1</span></div><div class="line">  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(-3750); <span class="comment">// X2</span></div><div class="line">  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(250);   <span class="comment">// Y2</span></div><div class="line">  </div><div class="line">  client-&gt;<a class="code" href="classArServerClient.html#a9276b1f38501725852c779058bad1d33">sendPacketUdp</a>(&amp;reply);</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keywordtype">void</span> <a class="code" href="drawingsExampleWithRobot_8cpp.html#abab39eb1a7fa3903841c77dabeb465f9">exampleArrowsDrawingNetCallback</a>(<a class="code" href="classArServerClient.html">ArServerClient</a>* client, <a class="code" href="classArNetPacket.html">ArNetPacket</a>* requestPkt) {</div><div class="line">  <span class="comment">// 1 Arrow that points at the robot</span></div><div class="line">  <a class="code" href="classArNetPacket.html">ArNetPacket</a> reply;</div><div class="line">  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(1);</div><div class="line">  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(0);      <span class="comment">// Pos. X</span></div><div class="line">  reply.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBasePacket.html#a6ab2c8b1224dc27fc96f22ff8f027e28">byte4ToBuf</a>(700);   <span class="comment">// Pos. Y</span></div><div class="line">  client-&gt;<a class="code" href="classArServerClient.html#a9276b1f38501725852c779058bad1d33">sendPacketUdp</a>(&amp;reply);</div><div class="line">}</div><div class="line"></div></div><!-- fragment --> </div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
  </ul>
</div>
</body>
</html>
